window: Fix window size snapping back
authorMatthias Clasen <mclasen@redhat.com>
Tue, 6 Oct 2020 00:22:02 +0000 (20:22 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 6 Oct 2020 00:24:19 +0000 (20:24 -0400)
We were not updating the remembered size at all when
the window is interactively resized, causing it to
snap back to its default size the next time we call
gdk_toplevel_present().

This is a bandaid fix to prevent very broken resizing
behavior, until we have properly redone toplevel sizing.

Fixes: #3076
gtk/gtkwindow.c

index 947b178f76d505cc254627c83aec530da4e44d10..7377502371778a4a0577d967a220932291fd28ae 100644 (file)
@@ -4729,6 +4729,22 @@ surface_size_changed (GtkWidget *widget,
 
   check_scale_changed (GTK_WINDOW (widget));
 
+  if (!(priv->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
+                       GDK_TOPLEVEL_STATE_MAXIMIZED |
+                       GDK_TOPLEVEL_STATE_TILED |
+                       GDK_TOPLEVEL_STATE_TOP_TILED |
+                       GDK_TOPLEVEL_STATE_RIGHT_TILED |
+                       GDK_TOPLEVEL_STATE_BOTTOM_TILED |
+                       GDK_TOPLEVEL_STATE_LEFT_TILED |
+                       GDK_TOPLEVEL_STATE_MINIMIZED)))
+    {
+      GtkWindowGeometryInfo *info;
+
+      info = gtk_window_get_geometry_info (GTK_WINDOW (widget), TRUE);
+      info->last.configure_request.width = width;
+      info->last.configure_request.height = height;
+    }
+
   /* priv->configure_request_count incremented for each
    * configure request, and decremented to a min of 0 for
    * each configure notify.
@@ -5490,7 +5506,6 @@ gtk_window_move_resize (GtkWindow *window)
   info->last.geometry = new_geometry;
   info->last.flags = new_flags;
   info->last.configure_request = new_request;
-
   /* need to set PPosition so the WM will look at our position,
    * but we don't want to count PPosition coming and going as a hints
    * change for future iterations. So we saved info->last prior to